package cn.com.dycc.party_org.team.controller;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.com.dycc.common.controller.BaseController;
import cn.com.dycc.party_org.team.entity.TeamResultEntity;
import cn.com.dycc.party_org.team.param.AddTeamParam;
import cn.com.dycc.party_org.team.param.FindPartyGroupParam;
import cn.com.dycc.party_org.team.service.TeamService;
import cn.com.dycc.util.JsonObjectResult;

@Controller
@RequestMapping("/partygroup")
public class TeamController extends BaseController{
	
	@Resource(name="teamService")
	private TeamService teamService;
	
	//增加党组班子
	@ResponseBody
	@RequestMapping("add.do")
	public JsonObjectResult addDeptPartyGroup(HttpServletRequest request,AddTeamParam addTeamParam){
		String mes = teamService.addDeptPartyGroup(request, addTeamParam);
		return new JsonObjectResult(mes);
	}
	
	//查询党组班子信息列表
	@ResponseBody
	@RequestMapping("findlist.do")
	public JsonObjectResult findPartyGroupList(HttpServletRequest request,FindPartyGroupParam findPartyGroupParam){
		List<TeamResultEntity> list = teamService.findPartyGroupList(request, findPartyGroupParam);
		String count = teamService.findPartyGroupListCount(request, findPartyGroupParam);
		return new JsonObjectResult(count,list);
	}
	
	//删除党组班子
	@ResponseBody
	@RequestMapping("del.do")
	public JsonObjectResult delPartyGroup(HttpServletRequest request,String dept_id,String user_id){
		String mes = teamService.delPartyGroup(request,dept_id, user_id);
		return new JsonObjectResult(mes);
	}
	
}
